<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
/*  Array.prototype.slice.call(arguments) 将arguments类数组对象转为数组
  1.rest参数代替arguments类数组对象
  2.设置函数参数初始值 
*/
 
//1.rest参数        bad
  function arguments(){
    // console.log('arguments',arguments);  
    const args = Array.prototype.slice.call(arguments,1)  //第二个参数代表截取起始位置
    return args.join('')
  }
  //good
  function rest(...args){
    //  args-> [1,2,3]
    return args.join('')
  }
  console.log(arguments(1,2,3)) //'23'
  console.log(rest(1,2,3));     //'123'



</script>  
</body>
</html>